package handler

import (
	"github.com/gin-gonic/gin"
	"tencent-video-hub/model"
)

func AddVideo(c *gin.Context) {
	title := c.PostForm("title")
	times := c.PostForm("times")
	types := c.PostForm("types")
	data := model.Video{
		Title: title,
		Times: times,
		Types: types,
	}
	model.DB.Create(&data).Debug()
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
	})
	return
}
func ListVideo(c *gin.Context) {
	var video []model.Video
	model.DB.Find(&video)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
		"data": video,
	})
}
